
<template>
  <div class="d-form-item">
    <label :style="labelStyle" :width="labelWidth" class="d-form-item_label">
      {{ label }}:
    </label>
    <div class="d-form-item_content">
      <slot></slot>
    </div>
  </div>
</template>
<script>
export default {
  name: "DFormItem",
  props: {
    label: {
      type: String,
      default: ""
    },
    labelWidth: {
      type: String,
      default: "80px"
    }
  },
  inject: ["Form"],
  computed: {
    labelStyle() {
      return {
        width: this.Form.labelWidth
      };
    }
  }
};
</script>
 
<style lang="scss" scoped>
.d-form-item {
  margin-bottom: 25px;
  .d-form-item_label {
    text-align: right;
    vertical-align: middle;
    float: left;
    font-size: 14px;
    color: #606266;
    line-height: 40px;
    padding: 0 12px 0 0;
    box-sizing: border-box;
  }
  .d-form-item_content {
    line-height: 40px;
    position: relative;
    font-size: 14px;
    overflow: hidde;
  }
}
</style>
